package org.jash.sportnews2109.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Upsert
import io.reactivex.rxjava3.core.Observable
import org.jash.sportnews2109.entity.News

@Dao
interface NewsDao {
    @Upsert
    fun save(vararg news:News)
    @Query("select * from news")
    fun findAll():Observable<List<News>>
    @Query("select * from news where id=:id")
    fun findById(id:Int):Observable<News>
    @Query("select * from news where title like :key")
    fun searchByKeyword(key:String):Observable<List<News>>
}